package com.gitee.wsl.collections.map

import androidx.collection.IntIntMap
import androidx.collection.MutableIntIntMap


/**
 * Returns an empty, read-only [IntIntMap].
 */
fun Maps.emptyIntIntMap(): IntIntMap = androidx.collection.emptyIntIntMap()

/**
 * Returns a new [MutableIntIntMap].
 */
fun Maps.intIntMapOf(): IntIntMap = androidx.collection.intIntMapOf()

/**
 * Returns a new [IntIntMap] with [key1] associated with [value1].
 */
fun Maps.intIntMapOf(
    key1: Int,
    value1: Int
): IntIntMap = MutableIntIntMap().also { map ->
    map[key1] = value1
}

/**
 * Returns a new [IntIntMap] with [key1], and [key2]
 * associated with [value1], and [value2], respectively.
 */
fun Maps.intIntMapOf(
    key1: Int,
    value1: Int,
    key2: Int,
    value2: Int,
): IntIntMap = MutableIntIntMap().also { map ->
    map[key1] = value1
    map[key2] = value2
}

/**
 * Returns a new [IntIntMap] with [key1], [key2], and [key3]
 * associated with [value1], [value2], and [value3], respectively.
 */
fun Maps.intIntMapOf(
    key1: Int,
    value1: Int,
    key2: Int,
    value2: Int,
    key3: Int,
    value3: Int,
): IntIntMap = MutableIntIntMap().also { map ->
    map[key1] = value1
    map[key2] = value2
    map[key3] = value3
}

/**
 * Returns a new [IntIntMap] with [key1], [key2], [key3], and [key4]
 * associated with [value1], [value2], [value3], and [value4], respectively.
 */
fun Maps.intIntMapOf(
    key1: Int,
    value1: Int,
    key2: Int,
    value2: Int,
    key3: Int,
    value3: Int,
    key4: Int,
    value4: Int,
): IntIntMap = MutableIntIntMap().also { map ->
    map[key1] = value1
    map[key2] = value2
    map[key3] = value3
    map[key4] = value4
}

/**
 * Returns a new [IntIntMap] with [key1], [key2], [key3], [key4], and [key5]
 * associated with [value1], [value2], [value3], [value4], and [value5], respectively.
 */
fun Maps.intIntMapOf(
    key1: Int,
    value1: Int,
    key2: Int,
    value2: Int,
    key3: Int,
    value3: Int,
    key4: Int,
    value4: Int,
    key5: Int,
    value5: Int,
): IntIntMap = MutableIntIntMap().also { map ->
    map[key1] = value1
    map[key2] = value2
    map[key3] = value3
    map[key4] = value4
    map[key5] = value5
}

/**
 * Returns a new [MutableIntIntMap].
 */
fun Maps.mutableIntIntMapOf(): MutableIntIntMap = MutableIntIntMap()

/**
 * Returns a new [MutableIntIntMap] with [key1] associated with [value1].
 */
fun Maps.mutableIntIntMapOf(
    key1: Int,
    value1: Int
): MutableIntIntMap = MutableIntIntMap().also { map ->
    map[key1] = value1
}

/**
 * Returns a new [MutableIntIntMap] with [key1], and [key2]
 * associated with [value1], and [value2], respectively.
 */
fun Maps.mutableIntIntMapOf(
    key1: Int,
    value1: Int,
    key2: Int,
    value2: Int,
): MutableIntIntMap = MutableIntIntMap().also { map ->
    map[key1] = value1
    map[key2] = value2
}

/**
 * Returns a new [MutableIntIntMap] with [key1], [key2], and [key3]
 * associated with [value1], [value2], and [value3], respectively.
 */
fun Maps.mutableIntIntMapOf(
    key1: Int,
    value1: Int,
    key2: Int,
    value2: Int,
    key3: Int,
    value3: Int,
): MutableIntIntMap = MutableIntIntMap().also { map ->
    map[key1] = value1
    map[key2] = value2
    map[key3] = value3
}

/**
 * Returns a new [MutableIntIntMap] with [key1], [key2], [key3], and [key4]
 * associated with [value1], [value2], [value3], and [value4], respectively.
 */
fun Maps.mutableIntIntMapOf(
    key1: Int,
    value1: Int,
    key2: Int,
    value2: Int,
    key3: Int,
    value3: Int,
    key4: Int,
    value4: Int,
): MutableIntIntMap = MutableIntIntMap().also { map ->
    map[key1] = value1
    map[key2] = value2
    map[key3] = value3
    map[key4] = value4
}

/**
 * Returns a new [MutableIntIntMap] with [key1], [key2], [key3], [key4], and [key5]
 * associated with [value1], [value2], [value3], [value4], and [value5], respectively.
 */
fun Maps.mutableIntIntMapOf(
    key1: Int,
    value1: Int,
    key2: Int,
    value2: Int,
    key3: Int,
    value3: Int,
    key4: Int,
    value4: Int,
    key5: Int,
    value5: Int,
): MutableIntIntMap = MutableIntIntMap().also { map ->
    map[key1] = value1
    map[key2] = value2
    map[key3] = value3
    map[key4] = value4
    map[key5] = value5
}
